Field of the Invention
The invention relates in general to a method for writing images into a memory, and more particularly to a method for writing images of a video stream into a memory.
Description of the Related Art
With the progress in the Internet and wireless transmission technologies, video streaming has become an emerging method for network multimedia broadcasting. In video streaming, multimedia data is encoded, transmitted from a transmitting end to a receiving end via the Internet or wireless transmission, and then downloaded, decoded and played at the receiving end. A feature of video streaming is that, instead of completely downloading and storing the multimedia data at the receiving end, a part of the multimedia data received is stored and processed at a memory buffer. After having played that part of the multimedia data, the space of the memory buffer is directly released for the use of the subsequently downloaded multimedia data.
For video streaming having a higher resolution provided by a transmitting end, due to a large file size, a data receiving speed at a receiving end may not keep up with a playback speed because of an insufficient network bandwidth or unstable signal strengths of wireless transmission at times, resulting in interrupted playback and depreciated user experiences. In one solution for solving the above situation, a resolution of images in the multimedia data is determined according to the bandwidth or the transmission speed. That is to say, by sacrificing the image resolution, contents of the video streaming can be played uninterruptedly under an insufficient bandwidth or a slower transmission speed.
In practice, a transmitting end may determine the image resolution outputted according to a current bandwidth or transmission speed. Upon detecting a wider bandwidth or a faster transmission speed, the transmitting end transmits a video stream having a higher resolution. Conversely, upon detecting a narrower bandwidth or a slower transmission speed, the transmitting end transmits a video stream having a lower resolution.
More specifically, when a receiving end receives video data, image data in the video data is separated through a demultiplexer, and a resolution of images in the image data is obtained from information of a packet header of the image data. A memory is then divided into a plurality of buffers according to the resolution, and decoded images are respectively written into the buffers. According to time information included in the images in the buffers, the images are sequentially accessed and played. When the resolution of the images changes, the resolution of the images obtained from demultiplexing at a client end also changes. At this point, the memory needs to be again divided into a plurality of buffers according to the changed resolution, and the images of the different resolution after decoding can then be respectively written into the re-divided buffers.
FIG. 1 shows a flowchart of a process of writing images into a memory in the prior art.
After a client end receives a video stream and obtains image data from the video stream by demultiplexing, step S100 is performed. In step S100, a first configuration table is established according to a first resolution of images in the image data. The first configuration table is associated with a utilization configuration of the memory and configures the memory into a plurality of first buffers. When later playing the images, the images in the memory are accessed and played according to information recorded in the first configuration table.
Data received by the receiving end is a video stream, i.e., the receiving end constantly receives new images. In step S120, an image is received from the video stream. Due to a change in the network bandwidth or wireless transmission speed, the received image may adopt a different resolution.
Thus, in step S140, it is determined whether the resolution of the image is still the first resolution according to the information in the video stream. When the resolution of the image is still the first resolution, step S185 is performed to write the image into the memory according to the first configuration table. When the resolution of the image is a second resolution, step S160 is performed to re-establish the first configuration table according to the second resolution. Step S180 is then performed to write the image into the memory according to the re-established first configuration table.
It is known from the above method for writing images into a memory in the prior art that, when the resolution of the received image changes from the first resolution to the second resolution, the first configuration table needs to be re-established according to the second resolution by step S160 in order to write the image having the second resolution into the memory. At this point, the memory still stores images that have not yet been accessed. However, as the first configuration table is re-established, it is equivalent to discarding the information of those images that have not yet been accessed, such that the playback procedure cannot access the information of the images that have not yet been accessed. As a result, these images that have not yet been accessed may be skipped and be replaced by a black image. That is to say, in the prior art, in the event of a resolution change, one or more images in the playback procedure may be presented by a black image, hence failing seamless switching and undesirably affecting user perceptual experiences.